﻿Imports System.Data.SqlClient
Imports System.Configuration
Public Class FmCapNhatNhaCC
    Dim Dt As New DataTable("NHA_CC")

    Private Sub FmCapNhatNhaCC_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        XdKetNoi()
        Dim dieuphoi As New SqlDataAdapter("Select * from NHA_CC", KetNoi)
        Dim DTKH As New DataTable
        dieuphoi.Fill(DTKH)
        KetNoi.Close()

        BindingSource1.DataSource = DTKH
        DgvNCC.DataSource = BindingSource1
        TxtTenNCC.DataBindings.Add("Text", BindingSource1, "TENCC")
        TxtDiaChi.DataBindings.Add("Text", BindingSource1, "DIACHI")
        TxtMST.DataBindings.Add("Text", BindingSource1, "MSTHUE")
        TxtSDT.DataBindings.Add("Text", BindingSource1, "SDTHOAI")
        TxtSoTK.DataBindings.Add("Text", BindingSource1, "STKHOAN")
        TxtTinh.DataBindings.Add("Text", BindingSource1, "TINH")


        CbMaNCC.DataSource = DTKH
        'CbMAHANG.DisplayMember = "MAHANG"
        CbMaNCC.ValueMember = "MACC"
        CbMaNCC.DataBindings.Add("SelectedValue", BindingSource1, "MACC")

        KetNoi.Close()

    End Sub
    Dim ChuoiSoSanh As String = String.Empty

    Private Sub BtXem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        XdKetNoi()
        Dim dieuphoi As New SqlDataAdapter("Select * from NHA_CC", KetNoi)

        Dim DTKH As New DataTable
        dieuphoi.Fill(DTKH)
        KetNoi.Close()
        DgvNCC.DataSource = DTKH

        DgvNCC.Columns(0).HeaderText = "Mã Nhà Cung Cấp"
        'DgvHangHoa.Columns(2).Width = 250
        'DgvHangHoa.Columns(3).Width = 100
        'DgvHangHoa.Columns(4).Width = 60
        'DgvHangHoa.Columns(1).Width = 200
        DgvNCC.Columns(1).HeaderText = "Tên Nhà Cung Cấp"
        DgvNCC.Columns(2).HeaderText = "Địa Chỉ"
        DgvNCC.Columns(3).HeaderText = "Số Điện Thoại"
        DgvNCC.Columns(4).HeaderText = "Tỉnh"
        DgvNCC.Columns(5).HeaderText = "Mã Số Thuế"
        DgvNCC.Columns(6).HeaderText = "Số Tài Khoản"

        KetNoi.Close()

    End Sub

    Private Sub BtThemMoi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub BtThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Close()
    End Sub

   
    Private Sub BtThemMoi_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtThemMoi.Click
        FmNewNhaCC.Show()
    End Sub

    Private Sub BtXem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtXem.Click
        XdKetNoi()
        Dim dieuphoi As New SqlDataAdapter("Select * from NHA_CC", KetNoi)

        Dim DTKH As New DataTable
        dieuphoi.Fill(DTKH)
        KetNoi.Close()
        DgvNCC.DataSource = DTKH

        DgvNCC.Columns(0).HeaderText = "Mã Nhà  Cung Cấp"
        'DgvHangHoa.Columns(2).Width = 250
        'DgvHangHoa.Columns(3).Width = 100
        'DgvHangHoa.Columns(4).Width = 60
        'DgvHangHoa.Columns(1).Width = 200
        DgvNCC.Columns(1).HeaderText = "Tên Nhà Cung Cấp"
        DgvNCC.Columns(2).HeaderText = "Địa Chỉ"
        DgvNCC.Columns(3).HeaderText = "Số Điện Thoại"
        DgvNCC.Columns(4).HeaderText = "Tỉnh"
        DgvNCC.Columns(5).HeaderText = "Mã Số Thuế"
        DgvNCC.Columns(6).HeaderText = "Số Tài Khoản"

        KetNoi.Close()
    End Sub
End Class